extends Node
class_name DirMachine

static func make_veci_rotate(veci:Vector2i,angle:float)->Vector2i:
	var vec:Vector2 = Vector2(veci)
	var new_vec:Vector2 = vec.rotated(angle)
	return Vector2i(new_vec)

static func get_angles_by_vecis(vecis:Array[Vector2i])->Array[float]:
	var angles:Array[float] = []
	for veci in vecis:
		var angle:float = Vector2(veci).angle()
		angles.append(angle)
	return angles

static func get_dirs_by_angles(dir:Vector2i,angles:Array[float])->Array[Vector2i]:
	var dirs:Array[Vector2i]
	var new_dir:Vector2 = Vector2(dir)
	for angle in angles:
		new_dir = make_veci_rotate(Vector2i(new_dir),angle)
		dirs.append(Vector2i(new_dir))
	return dirs

static  func get_four_dir_in_vector2()->Array[Vector2]:
	return [
		Vector2(1,0),
		Vector2(0,1),
		Vector2(-1,0),
		Vector2(0,-1),
		Vector2(0,0)
	]

static func get_four_dir_angle()->Array[float]:
	return [
		0,
		PI/2,
		PI,
		3 * PI / 2
	]
